<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>日志管理</title>
    <link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.js"></script>
    <script src="../../js/util.js"></script>
    <script type="text/javascript">
        layui.use(['table', 'form', 'laydate','jquery','element','layer'], function () {
            var table = layui.table;
            var form = layui.form;
            var layer = layui.layer;
            var $ = layui.$;
            var laydate=layui.laydate;
            var tabledata = {
                elem: "#table",//表格id
                id: "modelReload", //id
                url: '/oper/find',
                method: 'post',
                request: {
                    pageName: 'page',
                    limitName: 'limit'
                },
                response: {
                    statusName: 'code',
                    statusCode: 0,
                    msgName: 'msg',
                    countName: 'count',
                    dataName: 'data'
                },
                count: "count",
                limits: [10, 20, 30, 40, 50],
                layout: ['prev', 'page', 'next'],
                prev: "上一页",
                next: "下一页"
                , page: true //开启分页
                , cols: [[ //表头
                    {field: 'userName', title: '用户姓名',width : '8%',align: 'center'}
                    , {field: 'dutyName', title: '级别',width : '8%',align: 'center'}
                    , {field: 'msisdn', title: '手机号码',width : '8%',align: 'center'}
                    , {field: 'mgrName', title: '项目名称',width : '8%',align: 'center'} 
                    , {field: 'functionName', title: '操作功能',width : '15%',align: 'center'}
                    , {field: 'typeName', title: '操作描述',width : '8%',align: 'center'}
                    , {field: 'remark', title: '操作说明',width : '16%',align: 'center'}
                    , {field: 'resultName', title: '结果',width : '8%',align: 'center'}
                    , {field: 'operTime', title: '操作时间',width : '12%',align: 'center'}
                    , {field: 'operation', title: '查看明细',align: 'center', toolbar: '#barDemo'}
                ]]
            };
            table.render(tabledata);
            $('#find').on('click', function () {
                var index = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                table.reload('modelReload', {
                    method: 'post',
                    page: {
                        curr: 1
                    },
                    where: {
                        msisdn: $("#msisdn").val(),
                        mgrName: $("#mgrName").val(),
                        startTime:$("#startTime").val(),
                        endTime:$("#endTime").val(),
                        functionId:$("#functionId").val()
                    }
                });
                layer.close(index);
            });
            
            table.on('tool(table)', function (obj) {
                       var data = obj.data;
                       //var jsonParams=JSON.stringify(data);
                       if(data.functionName=="短信项目模板配置管理"){
                       		layer.open({
			                    title: '查看历史明细',
			                    type: 2,
			                    content: ['operLogTemplateHis.html?seqId='+data.seqId, 'yes'],
			                    area: ['40%', '50%'],
			                    scrollbar: true
		                	});
                       }else if(data.functionName=="地市标识管理"){
                       		layer.open({
			                    title: '查看历史明细',
			                    type: 2,
			                    content: ['operLogCitySignHis.html?seqId='+data.seqId, 'no'],
			                    area: ['40%', '50%'],
			                    scrollbar: true
		                	});
                       }else if(data.functionName=="短信内容管理"){
                       		layer.open({
			                    title: '查看历史明细',
			                    type: 2,
			                    content: ['operLogContentHis.html?seqId='+data.seqId, 'no'],
			                    area: ['40%', '50%'],
			                    scrollbar: true
		                	});
                       }
						
                    });
            
            laydate.render({
                elem: '#startTime'
            });
            laydate.render({
                elem: '#endTime'
            });
            //动态拼接操作功能
            function appendFunctions(data){
                if (data.length != null) {
                    var options = '<option value="">全部</option>';
                    for (var i = 0; i < data.length; i++) {
                        options += '<option value="' + data[i].id + '">' + data[i].name + '</option>';
                    }
                    $('#functionId').html(options);
                } else {
                    $('#functionId').html('未查找到操作类型');
                }
                form.render();
            }
            $(document).ready(function () {
            	$.ajax({
                    type: 'post',
                    async: false,
                    url: '/oper/findFunction',
                    success: function (json) {
                    	appendFunctions(json);
                    }
                });
            });
        });
    </script>
    <script type="text/html" id="barDemo">
		{{# if (d.type =="3" && d.seqId!=null && d.seqId!="" && (d.functionName=="地市标识管理" || d.functionName=="短信项目模板配置管理" || d.functionName=="短信内容管理") ){}}
         	<a href="#" lay-event="view">查看</a>
        {{#}}}
    </script>
</head>
<body>
<div class="layui-content-body">
    <div class="scroll-box">
        <div class="breadcrumb-box">
              <span class="layui-breadcrumb" lay-separator="|">
   <a href="javascript:returnIndex2()">首页&nbsp;</a>
  <a href=""> &nbsp;系统管理&nbsp; </a>
  <a href=""> &nbsp;日志管理&nbsp; </a>
</span>
        </div>
        <div class="content-box">
            <div class="form-select-box">
                <div class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">手机号</label>
                            <div class="layui-input-block">
                                <input type="text" name="msisdn" lay-verify="required" autocomplete="off" placeholder="请输入"
                                       class="layui-input" id="msisdn">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">项目名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="mgrName" lay-verify="required" autocomplete="off" placeholder="请输入"
                                       class="layui-input" id="mgrName">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">操作时间</label>
                            <div class="layui-input-inline" style="width: 100px;">
                                <input type="text" name="date" id="startTime" autocomplete="off" class="layui-input" placeholder="请输入">
                            </div>
                            <div class="layui-form-mid">-</div>
                            <div class="layui-input-inline" style="width: 100px;">
                                <input type="text" name="date" id="endTime" autocomplete="off"
                                       class="layui-input" placeholder="请输入">
                            </div>
                        </div>
                        <div class="layui-inline functionId">
		                            <label class="layui-form-label">操作功能</label>
		                            <div class="layui-input-block" style="width:150px">
		                                <select name="functionId" lay-filter="functionId" id="functionId">
		                                    <option value="">全部</option>
		                                </select>
		                            </div>
		                </div>
                        <div class="layui-inline">
                            <button class="layui-btn layui-btn-normal" id="find">查询</button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="table-box">
                <table class="layui-table" style="width: 850px" id="table" lay-filter="table">
                </table>
            </div>
        </div>
    </div>
</div>
</body>
</html>
